/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package util;

import java.io.File;
import java.io.FileFilter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author mwiatrowski
 */
public class UtilsFile {

    final static private String path = ".\\src\\model\\haar\\";
    private static File folder;
    private static String files;
    private static ArrayList<File> fileReturn;
    
    public static ArrayList<File> listOfFile() {
        fileReturn = new ArrayList<>();
        folder = new File(path);
        File[] listOfFiles = folder.listFiles();
        for (int i = 0; i < listOfFiles.length; i++) {
            if (listOfFiles[i].isFile()) {
                files = listOfFiles[i].getName();
                  if (files.endsWith(".xml") || files.endsWith(".XML")) {
                      fileReturn.add(listOfFiles[i]);
                }
            }
        }
        return fileReturn;
    }

    public static void main(String args[]) {
      ArrayList<File> file=listOfFile();
      for(File f:file){
      System.out.println(f.getAbsolutePath());
      }
    }

    public static String getCurrentaPath() {
        String current = null;
        try {
            current = new java.io.File(".").getCanonicalPath();
        } catch (IOException ex) {
            Logger.getLogger(Utils.class.getName()).log(Level.SEVERE, null, ex);
        }
        return current;
    }
}
